/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.delivery.parcel.client.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *
 * @author Malotana
 */
@Controller
public class HomeController {
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String home(Model model){
        return "index";
    }
    
    @RequestMapping(value = "/about")
     public String about(Model model){
         return "about";
     }
    
    @RequestMapping("/login")
    public String login(Model model, @RequestParam(required=false) String message) {
            model.addAttribute("message", message);
        return "login";
    }


    @RequestMapping(value = "/login/failure")
    public String loginFailure() {
            String message = "Login Failure!";
            return "redirect:/login?message="+message;
    }    
}
